package com.jsh.erp.controller;

import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.service.auditSynchronization.AuditSynchronizationService;
import com.jsh.erp.utils.ErpInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;


import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;

/**
 * @author wy
 * @title: AuditSynchronizationController
 * @projectName JSH_ERP
 * @description:
 * @date 2023-02-14 20:34
 */
@RestController
@RequestMapping(value = "/audit")
@Api(tags = {"审核同步"})
public class AuditSynchronizationController {
    @Resource
    private AuditSynchronizationService auditSynchronizationService;

    @PostMapping(value = "/updateByIdList",produces = "application/json;charset=UTF-8")
    public String updateByIdList(@RequestBody JSONObject jsonObject, HttpServletRequest request) throws Exception {
        Map<String, Object> objectMap = new HashMap<>();
        String ids = jsonObject.getString("ids");
        auditSynchronizationService.updateByIdList(ids);
        return returnJson(objectMap, ErpInfo.OK.name , ErpInfo.OK.code);
    }
}
